package com.kymatrix.mpo.plus.bpm.server.dao.task;

import com.kymatrix.mpo.plus.bpm.server.config.mybatis.mapper.BaseMapperX;
import com.kymatrix.mpo.plus.bpm.server.config.mybatis.query.LambdaQueryWrapperX;
import com.kymatrix.mpo.plus.bpm.server.model.entity.task.BpmProcessInstanceCopyEntity;
import com.kymatrix.mpo.plus.bpm.server.model.form.instance.PageQueryBpmProcessInstanceCopyReq;
import com.kymatrix.mpo.plus.common.business.common.PageResp;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface BpmProcessInstanceCopyMapper extends BaseMapperX<BpmProcessInstanceCopyEntity> {

    default PageResp<BpmProcessInstanceCopyEntity> selectPage(String loginUserId, PageQueryBpmProcessInstanceCopyReq reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BpmProcessInstanceCopyEntity>()
                .eqIfPresent(BpmProcessInstanceCopyEntity::getUserId, loginUserId)
                .likeIfPresent(BpmProcessInstanceCopyEntity::getProcessInstanceName, reqVO.getProcessInstanceName())
                .betweenIfPresent(BpmProcessInstanceCopyEntity::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BpmProcessInstanceCopyEntity::getId));
    }

}
